+2001-09-07 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (gtk_text_view_flush_scroll): update
+ adjustments after validating destination yrange; fixes #53918
+ (This may cause other issues, but I hope it won't)
+
+2001-09-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
+ line into start line, update the character counts in parent nodes;
+ caused a bug when end and start line had different parent nodes.
+
+2001-08-30 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
+ assertion that tag is in a table
+
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
-Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
+Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.
+2001-09-07 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (gtk_text_view_flush_scroll): update
+ adjustments after validating destination yrange; fixes #53918
+ (This may cause other issues, but I hope it won't)
+
+2001-09-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
+ line into start line, update the character counts in parent nodes;
+ caused a bug when end and start line had different parent nodes.
+
+2001-08-30 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
+ assertion that tag is in a table
+
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
-Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
+Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.
+2001-09-07 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (gtk_text_view_flush_scroll): update
+ adjustments after validating destination yrange; fixes #53918
+ (This may cause other issues, but I hope it won't)
+
+2001-09-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
+ line into start line, update the character counts in parent nodes;
+ caused a bug when end and start line had different parent nodes.
+
+2001-08-30 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
+ assertion that tag is in a table
+
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
-Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
+Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.
+2001-09-07 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (gtk_text_view_flush_scroll): update
+ adjustments after validating destination yrange; fixes #53918
+ (This may cause other issues, but I hope it won't)
+
+2001-09-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
+ line into start line, update the character counts in parent nodes;
+ caused a bug when end and start line had different parent nodes.
+
+2001-08-30 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
+ assertion that tag is in a table
+
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
-Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
+Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.
+2001-09-07 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (gtk_text_view_flush_scroll): update
+ adjustments after validating destination yrange; fixes #53918
+ (This may cause other issues, but I hope it won't)
+
+2001-09-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
+ line into start line, update the character counts in parent nodes;
+ caused a bug when end and start line had different parent nodes.
+
+2001-08-30 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
+ assertion that tag is in a table
+
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
-Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
+Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.
+2001-09-07 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (gtk_text_view_flush_scroll): update
+ adjustments after validating destination yrange; fixes #53918
+ (This may cause other issues, but I hope it won't)
+
+2001-09-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
+ line into start line, update the character counts in parent nodes;
+ caused a bug when end and start line had different parent nodes.
+
+2001-08-30 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
+ assertion that tag is in a table
+
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
-Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
+Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.
+2001-09-07 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (gtk_text_view_flush_scroll): update
+ adjustments after validating destination yrange; fixes #53918
+ (This may cause other issues, but I hope it won't)
+
+2001-09-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
+ line into start line, update the character counts in parent nodes;
+ caused a bug when end and start line had different parent nodes.
+
+2001-08-30 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
+ assertion that tag is in a table
+
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
-Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
+Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.
@show_toggle_indicator: unused
@show_submenu_indicator: whether to show the arrow or not
-<!-- ##### MACRO gtk_notebook_set_page ##### -->
-<para>
-</para>
-
-@notebook:
-@page_num:
-
<!-- ##### FUNCTION gtk_object_arg_get ##### -->
<para>
Private function to get an argument and argument info from an object.
@window:
@Returns:
-<!-- ##### FUNCTION gtk_window_get_resizeable ##### -->
-<para>
-
-</para>
-
-@window:
-@Returns:
-
<!-- ##### FUNCTION gtk_window_set_decorations_hint ##### -->
<para>
@window:
@functions:
-<!-- ##### FUNCTION gtk_window_set_resizeable ##### -->
-<para>
-
-</para>
-
-@window:
-@setting:
-@resizeable:
-
Adds a new #GtkMenuItem to the end of the menu's item list.
</para>
+<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
-<!-- # Unused Parameters # -->
@m:
@c:
Adds a new #GtkMenuItem to the beginning of the menu's item list.
</para>
-@menu_child:
<!-- # Unused Parameters # -->
+@menu_child:
@m:
@c:
@menu: a #GtkMenu.
indicated by @position.
</para>
+<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
@pos:
-<!-- # Unused Parameters # -->
@position: The position in the item list where @child is added.
Positions are numbered from 0 to n-1.
@Returns:
+<!-- ##### MACRO gtk_notebook_set_page ##### -->
+<para>
+</para>
+
+<!-- # Unused Parameters # -->
+@notebook:
+@page_num:
+
+
<!-- ##### FUNCTION gtk_notebook_next_page ##### -->
<para>
</para>
it's larger
+<!-- ##### FUNCTION gtk_window_set_resizeable ##### -->
+<para>
+
+</para>
+
+@window:
+@setting:
+<!-- # Unused Parameters # -->
+@resizeable:
+
+
+<!-- ##### FUNCTION gtk_window_get_resizeable ##### -->
+<para>
+
+</para>
+
+@window:
+@Returns:
+
+
<!-- ##### FUNCTION gtk_window_add_accel_group ##### -->
<para>
gint height;
gint width : 24;
- /* boolean indicating whether the height/width need to be recomputed */
+ /* boolean indicating whether the lines below this node are in need of validation.
+ * However, width/height should always represent the current total width and
+ * max height for lines below this node; the valid flag indicates whether the
+ * width/height on the lines needs recomputing, not whether the totals
+ * need recomputing.
+ */
gint valid : 8;
};
gtk_text_iter_order (start, end);
tree = _gtk_text_iter_get_btree (start);
-
+
+ if (gtk_debug_flags & GTK_DEBUG_TEXT)
+ _gtk_text_btree_check (tree);
+
{
/*
* The code below is ugly, but it's needed to make sure there
}
tags = _gtk_text_btree_get_tags (end,
- &array_size);
+ &array_size);
if (tags != NULL)
{
for (node = curnode; node != NULL;
node = node->parent)
{
+ /* Don't update node->num_chars, because
+ * that was done when we deleted the segments.
+ */
node->num_lines -= 1;
}
{
BTreeView *view;
GtkTextBTreeNode *ancestor_node;
-
GtkTextLine *prevline;
+ int chars_moved;
+ /* last_seg was appended to start_line up at the top of this function */
+ chars_moved = 0;
for (seg = last_seg; seg != NULL;
seg = seg->next)
{
+ chars_moved += seg->char_count;
if (seg->type->lineChangeFunc != NULL)
{
(*seg->type->lineChangeFunc)(seg, end_line);
}
}
+
+ for (node = start_line->parent; node != NULL;
+ node = node->parent)
+ {
+ node->num_chars += chars_moved;
+ }
+
curnode = end_line->parent;
for (node = curnode; node != NULL;
node = node->parent)
{
+ node->num_chars -= chars_moved;
node->num_lines--;
}
curnode->num_children--;
view = view->next;
}
+ /* avoid dangling pointer */
+ deleted_lines = NULL;
+
gtk_text_btree_rebalance (tree, curnode);
}
GtkTextTag *tag = tags[n];
GtkTextAttributes *vals = tag->values;
+ g_assert (tag->table != NULL);
if (n > 0)
g_assert (tags[n]->priority > tags[n-1]->priority);
gdouble yalign);
static gboolean gtk_text_view_flush_scroll (GtkTextView *text_view);
+static void gtk_text_view_update_adjustments (GtkTextView *text_view);
/* Container methods */
static void gtk_text_view_add (GtkContainer *container,
static gboolean
set_adjustment_clamped (GtkAdjustment *adj, gdouble val)
{
+ DV (g_print (" Setting adj to raw value %g\n", val));
+
/* We don't really want to clamp to upper; we want to clamp to
upper - page_size which is the highest value the scrollbar
will let us reach. */
if (val != adj->value)
{
+ DV (g_print (" Setting adj to clamped value %g\n", val));
gtk_adjustment_set_value (adj, val);
return TRUE;
}
if (!GTK_WIDGET_MAPPED (widget))
{
- g_warning ("%s: calling this function before mapping the GtkTextView doesn't make sense, maybe try gtk_text_view_scroll_to_mark() instead", G_STRLOC);
+ g_warning ("gtk_text_view_scroll_to_iter(): calling this function before showing the GtkTextView doesn't make sense, maybe try gtk_text_view_scroll_to_mark() instead");
return FALSE;
}
iter,
&rect);
+ DV (g_print (" target rect %d,%d %d x %d\n", rect.x, rect.y, rect.width, rect.height));
+
current_x_scroll = text_view->xoffset;
current_y_scroll = text_view->yoffset;
{
retval = set_adjustment_clamped (get_vadjustment (text_view),
current_y_scroll + scroll_inc);
+
+ DV (g_print (" vert increment %d\n", scroll_inc));
}
/* Horizontal scroll */
{
retval = set_adjustment_clamped (get_hadjustment (text_view),
current_x_scroll + scroll_inc);
- }
+ DV (g_print (" horiz increment %d\n", scroll_inc));
+ }
+
if (retval)
DV(g_print (">Actually scrolled ("G_STRLOC")\n"));
else
static gboolean
gtk_text_view_flush_scroll (GtkTextView *text_view)
{
- GtkTextIter iter, start, end;
+ GtkTextIter iter;
GtkTextPendingScroll *scroll;
- gint y0, y1, height;
gboolean retval;
DV(g_print(G_STRLOC"\n"));
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, scroll->mark);
- start = iter;
- end = iter;
-
- /* Force-validate the region around the iterator, at least the lines
- * on either side, so that we can meaningfully get the iter location
+ /* Validate arbitrary area around the scroll destination, so the adjustment
+ * can meaningfully point into that area
*/
- gtk_text_iter_backward_line (&start);
- gtk_text_iter_forward_line (&end);
-
- gtk_text_layout_get_line_yrange (text_view->layout, &start, &y0, NULL);
- gtk_text_layout_get_line_yrange (text_view->layout, &end, &y1, &height);
-
DV(g_print (">Validating scroll destination ("G_STRLOC")\n"));
- gtk_text_layout_validate_yrange (text_view->layout, &start, y0, y1 + height);
-
+ gtk_text_layout_validate_yrange (text_view->layout, &iter, -300, 300);
+
DV(g_print (">Done validating scroll destination ("G_STRLOC")\n"));
+
+ /* Ensure we have updated width/height */
+ gtk_text_view_update_adjustments (text_view);
retval = gtk_text_view_scroll_to_iter (text_view,
&iter,
{
if (upper != adj->upper)
{
- gdouble min = MAX (0., upper - adj->page_size);
+ gdouble min = MAX (0.0, upper - adj->page_size);
gboolean value_changed = FALSE;
adj->upper = upper;
if (value_changed)
{
- DV(g_print(">Changed adj value because upper descreased ("G_STRLOC")\n"));
+ DV(g_print(">Changed adj value because upper decreased ("G_STRLOC")\n"));
gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
}
}
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
gboolean blink;
+#ifdef DEBUG_VALIDATION_AND_SCROLLING
+ return FALSE;
+#endif
+
g_object_get (G_OBJECT (settings), "gtk-cursor-blink", &blink, NULL);
return blink;
}
static void
gtk_text_view_check_cursor_blink (GtkTextView *text_view)
{
-#ifdef DEBUG_VALIDATION_AND_SCROLLING
- return;
-#endif
-
if (text_view->layout != NULL &&
text_view->cursor_visible &&
GTK_WIDGET_HAS_FOCUS (text_view))
}
gtk_text_layout_validate_yrange (text_view->layout, &anchor, y0, y1);
-
+ /* FIXME do we need to update the adjustment ranges here? */
+
gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
newval = adj->value;
return FALSE;
}
+/* Don't copy this example, it's all crack-smoking - you can just use
+ * GtkMessageDialog now
+ */
gint
msgbox_run (GtkWindow *parent,
const char *message,
view_add_example_widgets (new_view);
}
+
+static void
+do_insert_and_scroll (gpointer callback_data,
+ guint callback_action,
+ GtkWidget *widget)
+{
+ View *view = view_from_widget (widget);
+ GtkTextBuffer *buffer;
+ GtkTextIter start, end;
+ GtkTextMark *mark;
+
+ buffer = view->buffer->buffer;
+
+ gtk_text_buffer_get_bounds (buffer, &start, &end);
+ mark = gtk_text_buffer_create_mark (buffer, NULL, &end, /* right grav */ FALSE);
+
+ gtk_text_iter_backward_char (&end);
+ gtk_text_buffer_insert (buffer, &end,
+ "Hello this is multiple lines of text\n"
+ "Line 1\n" "Line 2\n"
+ "Line 3\n" "Line 4\n"
+ "Line 5\n",
+ -1);
+
+ gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view->text_view), mark,
+ 0, TRUE, 0.0, 1.0);
+ gtk_text_buffer_delete_mark (buffer, mark);
+}
+
static void
do_wrap_changed (gpointer callback_data,
guint callback_action,
{ "/Attributes/Properties", NULL, do_properties, 0, NULL },
{ "/_Test", NULL, 0, 0, "<Branch>" },
{ "/Test/_Example", NULL, do_example, 0, NULL },
+ { "/Test/_Insert and scroll", NULL, do_insert_and_scroll, 0, NULL },
};
static gboolean